#合并两个列表
def remerge(list1,list2):
    return list1+list2

def remerge1(list1,list2):
    len1=len(list1)
    len2=len(list2)
    i,j=0,0
    fin=[]
    while i<=len1-1 and j<=len2-1:
        a,b=list1[i],list2[j]
        if a <= b:
            fin.append(a)
            i+=1
        if a>b:
            fin.append(b)
            j+=1
    if len1-i==len2-j:
        return fin
    elif len1-i>len2-i:
        return fin+list1[i:]
    else:
        return fin+list2[j:]
print(remerge1([1,3,5,7],[2,4,6]))